//
// Created by ta&to on 2022/9/14.
//
#include "httpserver.h"

void inittask(thread_pool_t *tpt){
    Thread_Pool_Init(tpt);
    tpt->initthreads = 15;
    tpt->maxthreads = 10000;
    tpt->minthreads = 10;
    Thread_Pool_Commit(tpt);
    Thread_Pool_Monitor(tpt);
}

void initlog(thread_pool_t *tpt,log_t *logt){
    log_init(logt);
    Thread_Task_Post(tpt, http_log_cycle, logt);
}

void doMain(thread_pool_t *tpt, log_t *logt, int listen_port, void* func) {
    http_socket_event_t *hset = (http_socket_event_t *) http_malloc(sizeof(http_socket_event_t));
    conn_init(tpt, logt, hset, listen_port, -1, __socket_r_callback, NULL);
    http_init(tpt, logt, hset, func);
}